﻿using System;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Windows.Phone.Management.Deployment;
using CompanyHub.Models;

namespace CompanyHub
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();

            // Set the data context of the listbox control to the sample data
            DataContext = App.ViewModel;

          //  var pkgs = InstallationManager.FindPackagesForCurrentPublisher();

        }

private void ItemSelected(object sender, SelectionChangedEventArgs e)
{
    if (e.AddedItems.Count > 0 && e.AddedItems[0] != null)
    {
        var pkg = e.AddedItems[0] as CompanyPackage;
        NavigationService.Navigate(new Uri("/PackagePage.xaml?id=" + pkg.PackageId, UriKind.Relative));

        (sender as LongListSelector).SelectedItem = null;

    }
}

        private void ListBox_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {

        }

    }
}